﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Markup;

namespace VideoLib.Converters
{
    public class WidthConverter : MarkupExtension, IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return (double)value / Limit;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return (double)value / Limit;
        }

        public static double Limit { get; set; } = 4.2;
        static WidthConverter instance = new WidthConverter();
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            return instance;
        }
    }
}
